import Mock, { Random } from 'mockjs';

module.export = [

  // Mock.mock(RegExp(`/testMock` + ".*"), 'post', {
  //   "data|5": [{
  //     _id: '@id',
  //     face: "@image('32x32')",
  //     cName: '@cname',
  //     is: '@boolean',
  //     num: '@integer(32,64)',
  //     float: '@float(0,100,1,2)',
  //     dateTime: "@datetime('yyyy-MM-dd HH:mm:ss')",
  //     text: '@cparagraph(1,3)',
  //     ip: '@ip',
  //     step: '@range(0,10,2)',
  //     "value|+1": 1
  //   }],
  // }),//测试数据，具体可查阅官方文档：http://mockjs.com/examples.html
  // Mock.mock(RegExp(`/testOptions` + ".*"), 'get', {
  //   "data|10": [{
  //     label: '@ctitle',
  //     "value|+1": 1
  //   }],
  // }),

  Mock.mock(RegExp(`/获取剩余审核消息列表` + ".*"), 'post', ({ url, type, body }) => {
    return Mock.mock({
      code: 200,
      "data|10": [{
        _msgId: '@id',
        content: '@cparagraph(1,3)',
        time: "@datetime('yyyy-MM-dd HH:mm:ss')"
      }],
      message: '',
    })
  }),
  Mock.mock(RegExp(`/获取直播间列表` + ".*"), 'post', ({ url, type, body }) => {
    // console.log(url, type, body)
    let total = Random.natural(1, 100);
    let pageLength = 10;
    let returnLength = Math.min(total, pageLength)


    let mArr = new Array(returnLength).fill(1).map((v, i) => {
      return Mock.mock({
        data: {
          id: '@id',
          title: '@ctitle(17,37)',
          desc: '@ctitle(17,37)',
          src: "@image('124x224')",
        }
      }).data
    })
    return Mock.mock({
      code: 200,
      data: {
        total: total,
        data: mArr,
      },
      message: '',
    })
  }),
  Mock.mock(RegExp(`/获取用户在线列表` + ".*"), 'post', ({ url, type, body }) => {
    let res = Mock.mock({
      code: 200,
      data: {
        total: 127,
        "data|19": [{
          id: '@id',
          face: "@image('124x224')",
          微信昵称: '@ctitle(17,37)',
          备注名: '@ctitle(17,37)',
          拨号管理: 'mock',
          is禁言: '@boolean',
          is访问状态: '@boolean',
          归属员工: '@cname',
          归属员工id: '@id'
        }],
      },
      message: '',
    })
    res.data.data.unshift({
      id: 0, face: "", 微信昵称: '固定测试', 备注名: '固定测试', 拨号管理: '固定测试',
      is禁言: false, is访问状态: false, 归属员工: '固定测试', 归属员工id: 83
    })
    return res;
  }),
  Mock.mock(RegExp(`/获取氛围执行记录` + ".*"), 'post', {
    code: 200,
    data: {
      total: 127,
      "data|20": [{
        id: '@id',
        执行人员id: '@id',
        执行人员: '@cname',
        执行时间: "@datetime('yyyy-MM-dd HH:mm:ss')",
        执行氛围内容: "@ctitle(17,31)",
        间隔时长: '@integer(1,10)',
        消息数量: '@integer(1,100)',
      }],
    },
    message: '',
  }),
  Mock.mock(RegExp(`/获取关键字屏蔽列表` + ".*"), 'post', {
    code: 200,
    data: {
      total: 127,
      "data|10": [{
        id: '@id',
        屏蔽关键字: '@cword(3,7)',
        添加时间: "@datetime('yyyy-MM-dd HH:mm:ss')",
      }],
    },
    message: '',
  }),
]